import { NextResponse } from 'next/server';
import { initDataFiles, initDefaultCategories } from '@/lib/data';
import { initAdminUser } from '@/lib/init';

// 初始化数据（仅用于开发环境）
export async function GET() {
  try {
    initDataFiles();
    initDefaultCategories();
    await initAdminUser();
    return NextResponse.json({ success: true, message: '数据初始化成功' });
  } catch (error) {
    return NextResponse.json(
      { success: false, message: '初始化失败' },
      { status: 500 }
    );
  }
}

